package com.yanqu.road.server.cmd.drugstore;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.drugstore.DrugStoreProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.drugstore.DrugStoreModule;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_DRUG_STORE_CHU_FANG_UPGRADE_ONE_KEY, desc = "处方升级(一键升级所有)")
public class DrugStoreChuFangOneKeyUpgradeCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ret = player.getModule(DrugStoreModule.class).upgradeChuFangOneKey();

    }

    @Override
    public void sendData(GamePlayer player) {
        if(ret != 0){
            player.sendPacket(Protocol.U_DRUG_STORE_CHU_FANG_UPGRADE_ONE_KEY, DrugStoreProto.DrugStoreChuFangUpgradeRespMsg.newBuilder().setRet(ret));
        }
    }
}
